using System;

//CID 0140 //2008.12.08 //Begin
namespace InfoJetSoft.Service.XPath.Tokens
{
	/// <summary>
	/// Summary description for Token.
	/// </summary>
	public class Token
	{
		private TokenType _type = TokenType.None;
		private string _value = null;

		public Token( TokenType type, string value )
		{
			this._type = type;
			this._value = value;
		}

		public TokenType Type
		{
			get
			{
				return this._type;
			}
			set
			{
				this._type = value;
			}
		}

		public string Value
		{
			get
			{
				return this._value;
			}
			set
			{
				this._value = value;
			}
		}

		public static bool CheckTokenRule( Token token )
		{
			if( token == null )
			{
				return true;
			}
			if (  ( token.Type.Equals( TokenType.Symbol ) && 
				  ( token.Value.Equals( "@" ) || 
					token.Value.Equals( "::" ) || 
					token.Value.Equals( "(" ) || 
					token.Value.Equals( "[" ) ) )
				 || token.Type.Equals( TokenType.Operator ) ) 
			{
				return true;
			}
			else
			{
				return false;
			}
		}

	}

	public enum TokenType
	{
		None = 0,
		Operator = 1,
		Symbol = 2,
		Literal = 3,
		Number = 4,
		Star = 5,
		NCStar = 6,
		NCName = 7,
		QName = 8
	}
}
//CID 0140 //2008.12.08 //End
